package png
{
	import flash.utils.ByteArray;

	public class PLTEChunk
	{
		public var colors:Vector.<uint> = new Vector.<uint>;
		
		public function PLTEChunk()
		{
		}
		
		public function setData( data:ByteArray ):void
		{
			var num:int = data.length / 3;
			for ( var i:int=0; i<num; i++)
			{
				var r:uint = data.readUnsignedByte();
				var g:uint = data.readUnsignedByte();
				var b:uint = data.readUnsignedByte();
				var color:uint = (r<<16) | (g<<8)  | b;
				colors.push(color);
			}
		}
		
		public function get length():int
		{
			return colors.length;
		}
		
		public function toString():String
		{
			return "PLTE chunk";
		}
	}
}